import { Injectable } from '@angular/core';

@Injectable()
export class Service {

  public zsurl:any;//访问url
  public prompt : any;//提示语
  public promptclose : any;//关闭提示
  public username: string;//登录用户
  public right: any = {};//权限
  public createUserId :any;//操作用户
  constructor() {
    this.prompt = {
      prompt  : false,
      success : false,
      fail    : false,
      promptStatement: ''
    };
    this.promptclose = setInterval(()=>{
      this.prompt = {prompt:false}
    },3000)

    // this.zsurl = 'http://192.168.0.155:8080';
    this.zsurl = 'http://118.31.66.123' 
    this.username = '';
    //this.right = {};
  }

  //存取权限
  public getRight() {
    return JSON.parse(sessionStorage.getItem('user-rights'));
  }
  public setRight(value) {
    sessionStorage.setItem('user-rights', JSON.stringify(this.right));
  }

  //存取用户
  public getuser() {
    return sessionStorage.getItem('user');
  }
  public setuser(value) {
    sessionStorage.setItem('user', this.createUserId);
  }

  public isActive = true;
  indent(){
    this.isActive = !this.isActive;
    return this.isActive;
  }

}
